package com.czy.owner.api;

import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import java.util.HashMap;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by wangyang on 2017/4/7 0007.
 * 收藏
 */

public class CollectionApi extends BaseApi {
    private String session ;
    private String collectType ;
    private String collectTypeId ;
    private String type ;


    public CollectionApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener,rxAppCompatActivity);
        setShowProgress(true);
        setCache(true);
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
    }

    public String getCollectType() {
        return collectType;
    }

    public void setCollectType(String collectType) {
        this.collectType = collectType;
    }

    public String getCollectTypeId() {
        return collectTypeId;
    }

    public void setCollectTypeId(String collectTypeId) {
        this.collectTypeId = collectTypeId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        HashMap<String,Object> map = new HashMap<>();
        map.put("session", getSession());
        map.put("collectType", getCollectType());
        map.put("collectTypeId", getCollectTypeId());
        map.put("type", getType());
        return service.getCollectionApi(map);
    }

}
